﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TpOffice.Controller;
using TpOffice.Interfaces;
using TecBaseObjects.Models;
using TecExtensions;

namespace TpOffice.Forms {

    public partial class CashSaleForm : Form, ITecForm {

        #region Members

        CashSaleController controller;

        #endregion

        #region Constructor

        public CashSaleForm() {
            this.controller = new CashSaleController(this);
            InitializeComponent();
            this.controller.LoadModels();
            this.SetFormDataSources();
        }

        #endregion

        #region Properties

        public List<CashSaleModel> MyModel {
            get;
            set;
        }

        #endregion

        #region Methods

        private void CloseForm(object sender, EventArgs e) {
            this.controller.CloseForm(sender, e);
        }
        
        private void CreateNewCashSale(object sender, EventArgs e) {
            this.controller.CreateNewCashSale(sender, e);
        }

        private void DatenInExcelFile(object sender, EventArgs e) {
            this.controller.ShowCoomingSoon();
        }

        private void OpenCashSaleDetail(object sender, DataGridViewCellMouseEventArgs e) {
            this.controller.OpenCashSaleDetail(sender, e);
        }

        private void ProgramInfo(object sender, EventArgs e) {
            this.controller.ShowCoomingSoon();
        }

        private void ReloadData(object sender, EventArgs e) {
            this.controller.ReloadData(sender, e);
        }

        public void SetFormDataSources() {
            this.bsCashSale.DataSource = null;
            this.bsCashSale.DataSource = this.MyModel;
            //this.dataGridView1.Controls["Datum"].DataBindings[0].FormatString = DateTime.Now.Date.Year.ToString().Right(2) + "00#";
        }

        
        

        #endregion

        #region Overrides

        public override string ToString() {
            return this.Text;
        }

        #endregion

        private void infoToolStripMenuItem_Click(object sender, EventArgs e) {

        }



    }
}
